﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;

public partial class Controls_login : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
            
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {

     KiemTraNhap(txtUser.Text, txtPass.Text);
    }


    private void KiemTraNhap(string tenDangNhap, string matKhau)
    {
        InfoDangNhap dangNhap = InfoDangNhap.DangNhapAcount(tenDangNhap, matKhau);
        //Label lb = (Label)Page.Page.Master.FindControl("lblAccount");

        if (dangNhap != null)
        {
            Session["TenDangNhap"] = dangNhap;

            lblLogin.Text = "Đăng Nhập Thành Công<br/> Xin Chao "+dangNhap.TenDangNhap;

           // Response.Redirect("Default.aspx");

            pnDangNhap.Visible = false;
        }
        else
        {

            lblLogin.Text = "Bạn Nhập Sai Email Hoặc Mật Khẩu";

        }
    }

}